<!doctype html>
{% extends "bootstrap/base.html" %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

{% block title %}首页{% endblock %}
{% block styles %}
    {{ super() }}
    <style>

        #myfoot {
            font-size: 14px;
            text-align: center;
            border-top: 1px solid darkgray;
            color: lightgray;

        }

        body {
            background: url("../static/images/sky.jpg");
        }

        #user_img {
            height: 50px;
            width: 50px;
            background-color: #00feff;
            position: absolute;
            right: 130px;

        }
        
    </style>

{% endblock %}

<body>

{% block navbar %}
    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">个人博客</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="{{ url_for('user.index') }}">首页<span
                            class="sr-only">(current)</span></a></li>
                    <li><a href="{{ url_for('user.show_about') }}">关于我</a></li>

                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                           aria-expanded="false">文章分类 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            {% for type in types %}
                                {% if not loop.last %}
                                    <li>
                                        <a href="{{ url_for('article.type_search') }}?tid={{ type.id }}">{{ type.type_name }}</a>
                                    </li>
                                    <li role="separator" class="divider"></li>
                                {% else %}
                                    <li>
                                        <a href="{{ url_for('article.type_search') }}?tid={{ type.id }}">{{ type.type_name }}</a>
                                    </li>
                                {% endif %}
                            {% endfor %}
                        </ul>
                    </li>
                    <li><a href="{{ url_for('user.myphoto') }}">我的相册</a></li>
                    <li><a href="{{ url_for('user.show_board') }}">留言板</a></li>
                </ul>
                <form class="navbar-form navbar-left">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Search"/>
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
                <!--            <div id="user_img">-->
                <!--                <img-->
                <!--                    src="#"-->
                <!--                    alt="" width="50" height="50"></div>-->
                <div id="user_img">
                    {% if user %}
                        <img src="{% if user.icon %}{{ url_for('static',filename=user.icon) }} {% else %}
                        {{ url_for('static',filename='images/touxiang.jpg') }}{% endif %} "
                             alt="" width="50" height="50">

                    {% else %}
                        <img src="../static/images/touxiang.jpg" alt="" width="50" height="50">
                    {% endif %}
                </div>

                <ul class=" nav navbar-nav navbar-right">
                    {% if user %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                               aria-haspopup="true"
                               aria-expanded="false">欢迎!{{ user.username }}<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ url_for('user.user_center') }}">用户中心</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="{{ url_for('user.logout') }}">退出</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li><a href="{{ url_for('user.login') }}">登录</a></li>
                        <li><a href="{{ url_for('user.register') }}">注册</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </nav>
{% endblock %}

{% block content %}
    {% block newcontent %}
        <h1>hello world!</h1>
    {% endblock %}

    {% block footer %}
        <div><p id="myfoot">©2021 小刘同学</p></div>
    {% endblock %}
{% endblock %}

</body>
</html>

